package org.example.model;

/**
 * @BelongsProject: Dynamic-relationship-binding
 * @BelongsPackage: org.example.model
 * @Author: dengxiyan
 * @CreateTime: 2025/07/04  10:50
 * @Description: 中间表
 * @Version: 1.0
 */

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@Table(indexes = {
        @Index(name = "idx_source", columnList = "sourceEntity,sourceId"),
        @Index(name = "idx_target", columnList = "targetEntity,targetId")
})
public class RelationMetadata extends BaseEntity {
    private String sourceEntity; // 源实体类名
    private Long sourceId;       // 源实体ID

    private String targetEntity; // 目标实体类名
    private Long targetId;       // 目标实体ID

    private String relationType; // 关系类型：ONE_TO_MANY, MANY_TO_ONE, MANY_TO_MANY
}
